package cn.stylefeng.guns.modular.business.frequency.ordertake.mapper;

import cn.stylefeng.guns.modular.business.frequency.orderpick.model.param.TakeRecordContractVO;
import cn.stylefeng.guns.modular.business.frequency.ordersub.model.param.OrderDTO;
import cn.stylefeng.guns.modular.business.frequency.ordersub.model.result.PkgTake;
import cn.stylefeng.guns.modular.business.frequency.ordertake.model.param.TakeDTO;
import cn.stylefeng.guns.modular.business.frequency.ordertake.model.result.PkgOrderDelivery;
import cn.stylefeng.guns.modular.business.frequency.statistics.PkgOrderTake;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.stylefeng.guns.modular.business.frequency.ordertake.entity.OrderTake;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * tt_order_take Mapper 接口
 *
 * @author yujie
 * @date 2023/05/09 17:16
 */
public interface OrderTakeMapper extends BaseMapper<OrderTake> {

    @Update("update tt_order_take set company_id = #{companyId} where settlement_id = #{linkmanId}")
    void updateCompanyIdByLinkmanId(@Param("companyId") Long companyId, @Param("linkmanId") Long linkmanId);

    PkgTake getPkgTakeDetail(@Param("orderId") Long orderId);


    List<PkgTake> getPkgTakeList(@Param("orderIdList") List<Long> orderIdList);


    /** 待送车列表 */
    Page<PkgOrderTake> getWaitTakeList(@Param("page") Page<Object> page, @Param("orderDTO") OrderDTO orderDTO);

    Long getWaitTakeNum( @Param("orderDTO") OrderDTO orderDTO);


    Page<PkgOrderDelivery> getWaitTakeCarOrderList(@Param("page") Page page, @Param("orderDTO") TakeDTO orderDTO);

    List<PkgOrderDelivery> getWaitTakeCarOrderList1(  @Param("orderDTO") TakeRecordContractVO orderDTO);


    @Select("select count(1) from tt_order_take where order_id = #{orderId}")
    int countByOrderId(@Param("orderId") Long orderId);


    List<PkgOrderTake> getWaitTakeExcludeList(@Param("orderDTO") OrderDTO orderDTO,@Param("tenant_id") Long tenantId);

}